/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package knowledgebase.model;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 *
 * @author eugene
 */
@Entity
@Table(name = "ROLE")
public class Role implements Serializable {
    
    private static final long serialVersionUID = 9163151665456764L;
    
    @Id
    @Column(name = "ROLE_ID")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;
    
    @Column(name = "ROLE_NAME")
    private String name;
    
    public Role() {
    }
    
    public Role(String name) {
        this.name = name;
    }

    public Role(int id, String name) {
        this.id = id;
        this.name = name;
    }

    public void setId(long id) {
        this.id = id;
    }

    public void setName(String name) {
        this.name = name;
    }

    public long getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    @Override
    public boolean equals(Object obj) {
        if(obj instanceof Role) {
            if(((Role) obj).getId() == this.id) return true;
        }
        return false;
    }
    
}